package com.ssy.lingxi.member.merchant.repository;

import com.ssy.lingxi.member.merchant.entity.MemberConfigDO;
import com.ssy.lingxi.member.merchant.entity.MemberDO;
import com.ssy.lingxi.member.merchant.entity.MemberRegisterDetailDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 会员注册资料仓库类
 * @author 万宁
 * @version 2.0.0
 * @date 2021-05-09
 */
@Repository
public interface MemberRegisterDetailRepository extends JpaRepository<MemberRegisterDetailDO, Long>, JpaSpecificationExecutor<MemberRegisterDetailDO> {

    List<MemberRegisterDetailDO> findByMemberConfig(MemberConfigDO memberConfig);

    List<MemberRegisterDetailDO> findByMemberAndVersion(MemberDO member, Integer version);

    List<MemberRegisterDetailDO> findByMember(MemberDO member);

    @Transactional
    void deleteByMember(MemberDO member);

    @Transactional
    void deleteByMemberConfig(MemberConfigDO memberConfigDO);
}
